from typing import Optional
from fastapi import Query

from app.core.base_response import BaseResponse
from app.service import user_service
from app.validator.model import LoginItem, RegisterItem


async def login(
        login_model: LoginItem
):
    data = await user_service.login(login_model)
    return BaseResponse.success(data=data)

async def register(
        reg_model:RegisterItem
):
    await user_service.register(reg_model)
    return BaseResponse.success()

async def rsa():
    data = await user_service.generate_rsa()
    return BaseResponse.success(data=data)